package com.hongyue.zuoYe1;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo {
    public static void main(String[] args) {
        Collection<Double> i = new ArrayList<>();
        i.add(88.5);
        i.add(39.2);
        i.add(77.1);
        i.add(56.8);
        i.add(89.0);
        i.add(99.0);
        i.add(59.5);
        Iterator<Double> it = i.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
        Iterator<Double> it1 = i.iterator();
        while (it1.hasNext()) {
            Double next = it1.next();
            if (next >= 60) {
                System.out.println("next = " + next);
            }
        }
        Double he = 0.0;
        int ge = 0;
        Iterator<Double> it2 = i.iterator();
        while (it2.hasNext()) {
            Double next = it2.next();
            if (next <= 60) {
                he += next;
                ge++;
            }
        }
        System.out.println("不及格的人数为"+ge+"平均分为"+he/ge);
        Iterator<Double> it3 = i.iterator();
        double max = 0;
        while (it3.hasNext()) {
            Double next = it3.next();
            if (next > max) {
                max = next;
            }
        }
        System.out.println("max = " + max);
    }
}
